<template>
  <ul class="list xbx">
    <li v-for="item in HotList" :key="item.id">
      <div class="u-cover">
        <img
          width="140"
          :src="item.picUrl"
          alt=""
        />
        <div class="bottom">
          <a href="javascript:;"></a>
          <span class="icon"></span>
          <span class="num">{{ item.trackCount }}万</span>
        </div>
      </div>
      <p class="text">
        <a href="javascript:;"> {{ item.name }}!</a>
      </p>
    </li>
  </ul>
</template>

<script>
import { HotListApi } from "@/request/api";
export default {
  data() {
    return {
      // 热门推荐列表
      HotList: [],
    };
  },
  created() {
    HotListApi().then((res) => {
      // console.log(res);
      if (res.data.code === 200) {
        let arr = res.data.result;
        for (let i = 0; i < 8; i++) {
          this.HotList.push(arr[i]);
        }
        // console.log(this.HotList)
      }
    });
  },
};
</script>
 
<style lang = "less" scoped>
@import "../../assets/base.less";
.list {
  width: 689px;
  margin-top: 20px;
  display: flex;
  justify-content: flex-start;
  flex-wrap: wrap;
  box-sizing: border-box;
  li {
    width: 140px;
    padding-right: 42px;
    padding-bottom: 30px;
    &:nth-of-type(4n) {
      padding-right: 0;
    }
    .u-cover {
      width: 140px;
      height: 140px;
      position: relative;
      .bottom {
        background: url("../../assets/images/coverall.png") no-repeat;
        position: absolute;
        bottom: 0;
        left: 0;
        width: 100%;
        height: 27px;
        background-position: 0 -537px;
        color: #ccc;
        a {
          background: url("../../assets/images/iconall.png") no-repeat;
          position: absolute;
          right: 10px;
          bottom: 5px;
          width: 16px;
          height: 17px;
          background-position: 0 0;
        }
        .icon {
          background: url("../../assets/images/iconall.png") no-repeat;
          float: left;
          width: 14px;
          height: 11px;
          background-position: 0 -24px;
          margin: 9px 5px 9px 10px;
        }
        .num {
          display: inline-block;
          margin: 7px 0 0 0;
        }
      }
    }
    .text {
      margin: 8px 0 3px;
      font-size: 14px;
      a {
        display: inline-block;
        color: #000;
      }
    }
  }
}
</style>